package com.wfl.sampling.entity.dto;

import com.wfl.sampling.entity.WxUserInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserDto implements Serializable {
    private Integer id;
    private String nickName;
    private String username;
    private String password;
    private String gender;
    private String phoneNumber;
    /*
    * 背景图片
    * */
    private String background;
    private String portrait;;
    private String openId;
    private String wxUnionId;
    /*
    *dto扩展属性
    * */
    private String token;
    List<String> permissions;
    List<String> roles;
    //验证码
    private String code;

    public void from(WxUserInfo wxUserInfo){
        this.nickName = wxUserInfo.getNickName();
        this.portrait = wxUserInfo.getAvatarUrl();
        this.username = "";
        this.phoneNumber = "";
        this.gender = wxUserInfo.getGender();
        this.openId = wxUserInfo.getOpenId();
        this.wxUnionId = wxUserInfo.getUnionId();
    }
}
